import request from '@/utils/request'

const api_name = '/admin/system/sysMenu'

export default {
    
    //获取菜单列表
    findNodes(){
        return request({
            //接口路径  ES6模版表达式
            url:  `${api_name}/findNodes`,
            //请求方式
            method: 'get'
        })
    },

    //删除
    removeById(id) {
        return request({
        url: `${api_name}/remove/${id}`,
        method: "delete"
        })
    },

    //保存 添加
    save(sysMenu) {
        return request({
        url: `${api_name}/save`,
        method: "post",
        data: sysMenu
        })
    },

    //更新
    updateById(sysMenu) {
        return request({
        url: `${api_name}/update`,
        method: "post",
        data: sysMenu
        })
    },

    //查看某个角色的权限列表
    toAssign(roleId) {
        return request({
        url: `${api_name}/toAssign/${roleId}`,
        method: 'get'
        })
    },

    //给某个角色授权
    doAssign(assginMenuVo) {
        return request({
        url: `${api_name}/doAssign`,
        method: "post",
        data: assginMenuVo
        })
    }
}